<template>
  <div>
    <el-form ref="form" :model="form" label-width="80px">
      <el-card class="box-card">
        <el-form-item label="密钥">
          <el-input v-model="form.key"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="genKey()">重新生成</el-button>
        </el-form-item>
      </el-card>
      <el-tabs v-model="form.activeName">
        <el-tab-pane label="全部" name="first"><Sm4ToolAll :encKey="form.key"></Sm4ToolAll></el-tab-pane>
        <el-tab-pane label="按行" name="second"><Sm4ToolLine :encKey="form.key"></Sm4ToolLine></el-tab-pane>
      </el-tabs>
  </el-form>
</div>
</template>

<script>
import { sm4GenKey } from '../../utils/crypto_sm4'
import Sm4ToolAll from './Sm4ToolAll'
import Sm4ToolLine from './Sm4ToolLine'
export default {
  name: 'Sm4Tool',
  components: { Sm4ToolAll, Sm4ToolLine },
  props: {},
  data () {
    return {
      form: {
        key: '',
        activeName: 'first'
      }
    }
  },
  watch: {
  },
  computed: {},
  methods: {
    genKey () {
      this.form.key = sm4GenKey()
    }
  },
  created () {},
  mounted () {
    this.genKey()
  }
}
</script>
<style scoped>
</style>
